package xhwl.insurance.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import xhwl.insurance.R;
import xhwl.insurance.util.StringUtil;


public class LoadingDialog extends Dialog {
	private Context mContext;
	private TextView tv;
	private String msg;
	public LoadingDialog(Context context, String msg) {
		super(context, R.style.loadingDialog);
		mContext=context;
		this.msg=msg;
//		setCancelable(false);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		LayoutInflater inflater = LayoutInflater.from(mContext);
		View view = inflater.inflate(R.layout.dialog_loading, null);
		setContentView(view);
		tv= (TextView)this.findViewById(R.id.tv);
		if(!StringUtil.isEmpty(msg))
		{
			tv.setText(msg);
		}
		LinearLayout linearLayout = (LinearLayout)this.findViewById(R.id.LinearLayout);
		linearLayout.getBackground().setAlpha(210);
	}
	public void setText(String msg){
		if(!StringUtil.isEmpty(msg))
		{
			tv.setText(msg);
		}
	}
}
